package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduSjtj01.*;
import com.jwsoft.manager.core.integration.EduSjtj01Integration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 业务统计查询网关
 *
 * @author hhj
 * @since 2023-04-10
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "业务统计查询", description = "业务统计查询")
public class EduSjtj01Controller {

    @Autowired
    public EduSjtj01Integration eduSjtj01Integration;

    @Operation(summary = "业务统计查询分页查询",description = "业务统计查询分页查询")
    @PostMapping(value = "/sjtj010001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSjtj01VO>> getList(@RequestBody @Validated EduSjtj01QueryVO vo) {
        return AppResponse.successData(eduSjtj01Integration.getList(vo));
    }

    @Operation(summary = "业务统计查询根据主键查询详情",description = "业务统计查询根据主键查询详情")
    @PostMapping(value = "/sjtj010002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj01VO> getById(@RequestBody @Validated EduSjtj01KeyVO vo) {
        return AppResponse.successData(eduSjtj01Integration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "业务统计查询新增",description = "业务统计查询新增")
    @PostMapping(value = "/sjtj010004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj01InVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSjtj01InVO vo) {
        return AppResponse.successData(eduSjtj01Integration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "业务统计查询修改",description = "业务统计查询修改")
    @PostMapping(value = "/sjtj010005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj01VO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSjtj01VO vo) {
        return AppResponse.successData(eduSjtj01Integration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "业务统计查询删除",description = "业务统计查询删除")
    @PostMapping(value = "/sjtj010006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSjtj01KeyVO vo) {
        eduSjtj01Integration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "查询结果展示",description = "查询结果展示")
    @PostMapping(value = "/sjtj010007", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj01ResVO> getResData(@RequestBody @Validated EduSjtj01InVO vo) {
        return AppResponse.successData(eduSjtj01Integration.getResData(vo));
    }
}
